const initialState = {
  name: 'xia',
  age: 18
}

export const reduer = (preState=initialState, action) =>{
  const {type, payload} = action
  console.log(action)
  switch(type){
    case 'incrementAge':
      return {...preState,age:preState.age+1}
    case 'decrementAge':
      return {...preState,age:preState.age-1}
    case 'changePerson':
      return {...payload}
    default:
      return preState
  }
}